<script>
    var enable_submit = true;
    $(function () {
        $('#user_repnum').rqDropDown({
            position: true,
            "datatype": "local",
            "source": get_repnums()
        });
        var obj = {
            "user_name": "由3至32位小写英文字母、数字、中划线构成。",
            "chap_name": "由3至32位字符构成。",
            "chap_password": "由12至16位字符构成。",
            'user_quota': '可不填写，若填写，则应为大于0的整数'
        }
        bindMouseEvent('#user_update_modal', obj);
    });
</script>
<div class="modal-header">
    <h3>[["Edit User"|translate]]</h3>
</div>
<div class="modal-body modal-body-height" id="user_update_modal">
    <div class="user-update-box">
        <div class="rtn-tip"></div>
        <table class="super-info" style="margin-top: 0;">
            <tr>
                <td>
                    <label>保护域</label>
                </td>
                <td>
                    {% for pd in pds %}
                    {% if pd.id in user_pd_ids %}
                    <label><input type="checkbox" class="user_pds" value="{{pd.id}}" checked>{{pd.name}}</label>
                    {% else %}
                    <label><input type="checkbox" class="user_pds" value="{{pd.id}}">{{pd.name}}</label>
                    {% endif %}
                    {% endfor %}
                </td>
                <td>配额</td>
                <td>
                    <input type="text" name="quota" id="user_quota" value="{{user.quota|default('', True) }}">
                    <i class="fa fa-question-circle" itype="user_quota"></i>
                    
                </td>
            </tr>
            <tr>
                <td>
                    <label>副本数</label>
                </td>
                <td>
                    <input id="user_repnum" readonly="readonly" class="rounded_dropdown" value='{{user.repnum}}'
                           realvalue="{{user.repnum}}"/>
                </td>
                <td></td>
                <td></td>
            </tr>
        </table>
        <table class="user-info">
            <tr>
                <td>
                    <label>[["label chap name"|translate]]</label><a>*</a>
                </td>
                <td>
                    <input type="text" name="chap_name" id="chap_name" value="{{user.sp_chap_name}}">
                    <i class="fa fa-question-circle" itype="chap_name"></i>
                </td>
                <td>
                    <label>[["label chap password"|translate]]</label><a>*</a>
                </td>
                <td>
                    <input type="password" name="chap_password" id="chap_password" autocomplete="off" readonly
                           onfocus="this.removeAttribute('readonly');" onpaste="return false"
                           oncontextmenu="window.event.returnValue=false" value="{{user.sp_chap_password}}">
                    <i class="fa fa-eye" style="right:60px"></i>
                    <i class="fa fa-question-circle" itype="chap_password"></i>
                </td>
            </tr>
        </table>
    </div>
    <div class="error-tip">
        <p></p>
        <span></span></div>
    <div class="tip">
        <p></p>
        <span></span></div>
</div> <!--.modal-body-->
<div class="modal-footer">
    <button class="btn btn-blue" ng-click="update('{{user.id}}')">[[ 'label ok'|translate ]]</button>
    <button class="btn btn-white" ng-click="cancel()">[[ 'label cancel'|translate ]]</button>
</div>  
